package activities;

import com.iculture.FirstJsonExUrlActivity;
import com.iculture.R;
import com.navdrawer.SimpleSideDrawer;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;

public class GlobalActivity extends Activity {
	protected ImageButton buttonSlideMenu;
	protected Button buttonSchedule;
	protected Button buttonMatch;
	protected Button buttonActivity;
	protected SimpleSideDrawer slideMenu;
	
	protected void findView() {
		buttonSlideMenu = (ImageButton)findViewById(R.id.buttonSlideMenu);
		slideMenu = new SimpleSideDrawer(GlobalActivity.this);
		slideMenu.setBehindContentView(R.layout.slidemenu);
		buttonMatch = (Button)findViewById(R.id.buttonMatch);
		buttonSchedule = (Button)findViewById(R.id.buttonSchedule);
		buttonActivity = (Button)findViewById(R.id.buttonActivity);
	}
	
	protected void setListenerOrAdapter() {
		buttonSlideMenu.setOnClickListener(new ButtonSlideMenuOnClickListener());
		buttonMatch.setOnClickListener(new ButtonMatchOnClickListener());
		buttonSchedule.setOnClickListener(new ButtonScheduleOnClickListener());
		buttonActivity.setOnClickListener(new ButtonActivityOnClickListener());
	}
	
	protected class ButtonSlideMenuOnClickListener implements ImageButton.OnClickListener {

		@Override
		public void onClick(View v) {
			slideMenu.toggleDrawer();
		}
	}
	
	protected class ButtonMatchOnClickListener implements Button.OnClickListener {

		@Override
		public void onClick(View v) {
			Intent intent = new Intent();
			
			intent.setClass(GlobalActivity.this, MatchActivity.class);
			startActivity(intent);
			GlobalActivity.this.finish();
		}
	}
	
	protected class ButtonScheduleOnClickListener implements Button.OnClickListener {

		@Override
		public void onClick(View v) {
			Intent intent = new Intent();
			
			intent.setClass(GlobalActivity.this, ScheduleActivity.class);
			startActivity(intent);
			GlobalActivity.this.finish();
		}
	}
	
	protected class ButtonActivityOnClickListener implements Button.OnClickListener {

		@Override
		public void onClick(View v) {
			Intent intent = new Intent();
			
			intent.setClass(GlobalActivity.this, FirstJsonExUrlActivity.class);
			startActivity(intent);
			GlobalActivity.this.finish();
		}
	}
}
